---
layout: "default"
title: "JoinGenerator"
description: "Swift documentation for 'JoinGenerator': A generator that presents the elements of the sequences generated."
keywords: "JoinGenerator,struct,swift,documentation,next"
root: "/v2.2"
---

<div class="intro-declaration"><code class="language-swift">struct JoinGenerator&lt;Base : GeneratorType where Base.Element : SequenceType&gt;</code></div>

<div class="discussion comment">
    <p>A generator that presents the elements of the sequences generated
by <code>Base</code>, concatenated using a given separator.</p>
</div>

<table class="standard">
<tr>
<th id="inheritance">Inheritance</th>
<td>
<code class="inherits">GeneratorType</code>
<span class="viz"><a href="hierarchy/">View Protocol Hierarchy &rarr;</a></span>
</td>
</tr>



<tr>
<th>Import</th>
<td><code class="language-swift">import Swift</code></td>
</tr>

</table>


<h3>Initializers</h3>
<div class="declaration" id="init-base_separator_">
<a class="toggle-link" data-toggle="collapse" href="#comment-init-base_separator_">init(<wbr>base:<wbr>separator:)</a><div class="comment collapse" id="comment-init-base_separator_"><div class="p">
    <p>Creates a generator that presents the elements of the sequences
generated by <code>base</code>, concatenated using <code>separator</code>.</p>

<p><strong>Complexity:</strong> O(<code>separator.count</code>).</p>

    <h4>Declaration</h4>    
    <code class="language-swift">init&lt;Separator : SequenceType where Separator.Generator.Element == Base.Element.Generator.Element&gt;(base: Base, separator: Separator)</code>

    </div></div>
</div>





<h3>Instance Methods</h3>
<div class="declaration" id="func-next">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-next">mutating func next()</a>
        
<div class="comment collapse" id="comment-func-next"><div class="p">
    <p>Advance to the next element and return it, or <code>nil</code> if no next
element exists.</p>

    <h4>Declaration</h4>    
    <code class="language-swift">mutating func next() -&gt; Base.Element.Generator.Element?</code>
    
    
</div></div>
</div>


